import { Component } from 'react'
import Taro from '@tarojs/taro'
import './app.scss'

class App extends Component {
  componentDidMount() {
    // 初始化云开发
    if (process.env.TARO_ENV === 'weapp') {
      try {
        Taro.cloud.init({
          env: Taro.cloud.DYNAMIC_CURRENT_ENV,
          traceUser: true
        })
        console.log('云开发初始化成功')
      } catch (error) {
        console.error('云开发初始化失败:', error)
      }
    }
  }

  componentDidShow() {}

  componentDidHide() {}

  componentDidCatchError() {}

  // this.props.children 是将要会渲染的页面
  render() {
    return this.props.children
  }
}

export default App
